struct Point {
    x: i32,
    y: i32,
}

impl Point {
    fn new(x: i32, y: i32) -> Self {
        Self { x, y }
    }
    fn distance(&self, other: &Point) -> f64 {
        let dx = self.x - other.x;
        let dy = self.y - other.y;
        ((dx.pow(2) + dy.pow(2)) as f64).sqrt()
    }
}

fn main() {
    let p1 = Point::new(0, 0);
    let p2 = Point::new(3, 4);
    let distance = p1.distance(&p2);
    let dis = Point::distance(&p1, &p2);
    println!("Distance between p1 and p2 is {}", distance);
}
